#ifndef HTTPMGR_H
#define HTTPMGR_H
#include<memory>
#include<QNetworkAccessManager>
#include"singleton.h"
#include"global.h"
#include<QJsonObject>
class HttpMgr:public QObject, public std::enable_shared_from_this<HttpMgr>
{
    Q_OBJECT
public:
    ~HttpMgr();
    HttpMgr();

    void PostHttpReq(QUrl url,QJsonObject json,ReqId id,MoudleId mid);
public slots:
    void slot_http_finish(ReqId id,Ecode error,MoudleId mid,QString res);
private:

QNetworkAccessManager m_qnetworkmgr;

signals:
    void sig_http_finish(ReqId id,Ecode error,MoudleId mid,QString res);
    void sig_reg_http_finish(ReqId id,QString res,Ecode err);
    void sig_resetpsw_http_finish(ReqId id,QString res,Ecode error);
    void sig_login_http_finish(ReqId id,QString res,Ecode error);
};

typedef Singletonptr<HttpMgr> _HttpMgr;
#endif // HTTPMGR_H
